home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / include / vectP.h < prev    next >
C/C++ Source or Header  |  1992-02-25  |  3KB  |  77 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
  11.  
  12. #ifndef VECTPDEF
  13. #define VECTPDEF
  14.  
  15. #include "geomclass.h"
  16. #include "vect.h"
  17.  
  18. /*
  19.  * A Vect is a collection of polylines.
  20.  * It's represented by:
  21.  *  p,  an array of vertices (for all the polylines in sequence),
  22.  *  c,  an array of r/g/b/alpha colors (not necessarily one per vertex),
  23.  *  vnvert, an array of sizes (vertex counts) of each polyline,
  24.  *  vncolor, an array of numbers of colors (c[] entry counts) of each polyline,
  25.  *  nvec, giving the number of polylines (entries in vnvert and vncolor),
  26.  *  nvert, giving the total number of vertices (entries in p),
  27.  *  ncolor, the total number of colors (entries in c).
  28.  *
  29.  * Here's the association:
  30.  *    Let vN = sum from i = 0 to N-1 of vnvert[i],
  31.  *    and cN = sum from i = 0 to N-1 of vncolor[i],
  32.  *    then polyline N comprises the vnvert[N] vertices
  33.  *    from p[vN] through p[vN + vnvert[N] - 1]
  34.  *    and is drawn using the vncolor[N] different colors
  35.  *    from c[cN] through c[cN + vncolor[N] - 1].
  36.  *
  37.  * This encoding implies colors and vertices may not be reused from line to
  38.  * line (but the previous color persists for lines with 0 colors, see below).
  39.  *
  40.  * Closed polylines:
  41.  *    A polyline is drawn closed (the last element connected to the first)
  42.  *    if its vnvert[N] is negative.  It's then considered to have
  43.  *    abs(vnvert[N]) vertices in the p[] array.
  44.  *
  45.  * A polyline with 1 vertex is a point.  0 vertices are illegal.
  46.  *
  47.  * Coloring:
  48.  *    It's intended that polylines will be specified with either
  49.  *    0, 1, or abs(vnvert[N]) colors.  The effects in each case are:
  50.  *     0: the polyline is drawn with the same color as the previous polyline.
  51.  *     1: the polyline is drawn with the specified single color.
  52.  *     abs(vnvert[N]): each vertex is colored with the specified color.
  53.  *        intermediate points on the line are interpolated.
  54.  */
  55.  
  56. struct Vect {
  57.     GEOMFIELDS
  58.     int    flag, nvec, nvert, ncolor;
  59.     int    seq;        /* for 4D -> 3D tforms */
  60.     short    *vnvert;    /* vnvert[nvec] (# p[]'s per vec) */
  61.     short    *vncolor;    /* vncolor[nvec] (# c[]'s per vec) */
  62.         /* NOTE: vnvert and vncolor lie in a *single* malloc'ed area */
  63.         /* To free, OOGLFree(vnvert). */
  64.     HPoint3    *p;        /* p[nvert] */
  65.     ColorA    *c;        /* c[ncolor] */
  66. };
  67.  
  68.  
  69. #define VECT_4D        1
  70.  
  71. extern Vect *VectCreate( Vect *, GeomClass *, va_list );
  72. extern void  VectDelete( Vect * );
  73. extern Vect *VectCopy( Vect * );
  74. extern Vect *VectPick( Vect *, Pick *, Appearance *, Transform );
  75.  
  76. #endif /*VECTPDEF*/
  77.